##纯算法方式
arr_list=[5,7,11,22,27,33,39,52,58]
number=22
count=0
left=0
right=len(arr_list)-1

while left<=right:
    middle=(left+right)//2
    count+=1
    if number>arr_list[middle]:
        left=middle+1
    elif number<arr_list[middle]:
        right=middle-1
    else:
        print(f'找到了，索引值{middle}')
        break
else:
    print(f'数字{number}没找到了')
print(f'一共用了{count}次查找')